
import com.wider.foundation.xString;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author B1367
 */
public class generalTry {
    public static void main(String args[]) {

    /*
        try {
            /*
            NetChannelResponseHandler hndlr = new NetChannelResponseHandler() {
            @Override
            public void handle(Object callbackID, int resp_code, String resp_mesg, InputStream stream_in) throws IOException {
            System.out.println("RESP: OBJ-ID=" + callbackID + " CODE=" + resp_code + " MESG=" + resp_mesg);
            }
            @Override
            public void handle(Object callbackID, Throwable ex) {
            System.out.println("EX: OBJ-ID=" + callbackID + " MESG=" + ex.getMessage());
            }
            };
            Map<String, String> params = new HashMap<String, String>();
            params.put("TO", "KIKI");
            params.put("MSG", "I LOVE YOU");
            NetChannelRequest reqst = new NetChannelRequest("Get", params, hndlr, "General Try", 1000);
            try {
            reqst.callback(200, "Success", null);
            } catch (IOException ex) {
            Logger.getLogger(generalTry.class.getName()).log(Level.SEVERE, null, ex);
            }
            for (Entry<?, ?> e : reqst){
            System.out.println("KEY: " + (String) e.getKey() + " VAL: " + (String) e.getValue());
            }
            List single = new ArrayList();
            single.add(reqst);
             *
             */

            /*
            File[] files = new File[2];
            files[0] = new File("C:\\kiki.jpg");
            files[1] = new File("C:\\copy.jpg");
            File fa = new File("D:\\Vivi.jpg");
            File[] faa = new File[1];
            faa[0] = fa;
            System.out.println("faa: " + faa[0].getName());
            Object ref = files;
            System.out.println("Type? " + (ref instanceof File[]));
            System.out.println("Type? " + (ref instanceof File));
            String[] strs = {"Hello", "world"};
            int[] ints = {100, 200};
            List alist = new ArrayList();
            alist.add(strs);
            alist.add(ints);
            alist.add("not an array");
            func(alist);
            final DLoggerRoot dlog = DLogger.getRoot();
            dlog.setStream(System.out);
            dlog.setLevel(DLogger.DLevel.DEBUG);
            dlog.enable();
            final ChannelRequest req = new ChannelRequest("GET", null, null, null, 8000);
            Thread th = new Thread(new Runnable() {

                @Override
                public void run() {
                    try {
                        Thread.sleep(2000);
                        //req.callback(200, "OK", null);
                        req.cancel();
                    //} catch (IOException ex) {
                    //    dlog.warn(ex);
                    } catch (InterruptedException ex) {
                        dlog.warn(ex);
                    }
                }
            });
            dlog.debug("Start the timer thread");
            th.start();
            dlog.debug("Joining...");
            req.join();
            dlog.debug("Joined back!");
            
        } catch (InterruptedException ex) {
            Logger.getLogger(generalTry.class.getName()).log(Level.SEVERE, null, ex);
        }

        Map req1_p  = new HashMap();
        Map req2_p  = new HashMap();

        req1_p.put("CMD", "UPLOAD FILE");
        req1_p.put("FILES", new String[]{"copy.jpg", "kiki.jpg"});

        req2_p.put("FROM", "William Choi");
        req2_p.put("TO", "MELISA");
        req2_p.put("MSG", "I LOVE YOU");
        req2_p.put("DBL", new Double(0.9989));
        //req2_p.put("TEL", 62798308);
        
        ChannelRequest req1 = new ChannelRequest("POST", req1_p, null, null, 3000);
        ChannelRequest req2 = new ChannelRequest("POST", req2_p, null, null, 2000);
        ChannelRequest req3 = new ChannelRequest("GET", req1_p, null, null, 3000);
        ChannelRequest req4 = new ChannelRequest("GET", req2_p, null, null, 2000);
        List reqlist = new ArrayList();
        reqlist.add(req1);
        reqlist.add(req2);
        reqlist.add(req3);
        reqlist.add(req4);
        HttpChannel.muxRequests(reqlist);
        */

        String str1 = "The one i Love is, namie amuro. I love her so much";
        System.out.println(xString.substring(str1, "namie"));
        System.out.println(xString.substringAfter(str1, "The one i Love is, "));
        System.out.println(xString.substring(str1, "na", "ro"));
        System.out.println(xString.substringBetween(str1, "is, ", ". I love"));

        System.out.println(Boolean.valueOf("truehaha"));
        System.out.println(Boolean.valueOf("falsehaha"));

        String url = "jdbc:sqlserver://user@##HOST;databaseName=##DB";
        System.out.println(url.replace(xString.substring(url, "://", "@"), "://"));
        System.out.println(xString.substringBetween(url, "://", "@"));
    }
}
